//
//  AccessControlViewController.swift
//  test_swift
//
//  Created by fangyuan ding on 2021/6/1.
//

import UIKit

class AccessControlViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        class Samplepgm {
            fileprivate var counter: Int = 0{
                willSet(newTotal){
                    print("计数器: \(newTotal)")
                }
                didSet{
                    if counter > oldValue {
                        print("新增加数量 \(counter - oldValue)")
                    }
                }
            }
        }
         
        let NewCounter = Samplepgm()
        NewCounter.counter = 100
        NewCounter.counter = 800
    }
    


}
